import pandas as pd
import lxml

#北京
def row_data():
    air_beijing = pd.read_html('http://www.weather.com.cn/textFC/hb.shtml', encoding='utf-8')
    df = air_beijing[0]
    title_01 = df[0:1].T[0].tolist()
    title_02 = df[1:2].T[1].tolist()
    td_data = []
    for i in range(10):
        td_data.append(df[i+2:i+3].T[i+2].tolist())

    return title_01,title_02,td_data

#上海
def row_data_shanghai():
    air_shanghai = pd.read_html('http://www.weather.com.cn/textFC/hd.shtml', encoding='utf-8')
    df = air_shanghai[0]
    title_01 = df[0:1].T[0].tolist()
    title_02 = df[1:2].T[1].tolist()
    td_data_shanghai = []
    for i in range(10):
        td_data_shanghai.append(df[i+2:i+3].T[i+2].tolist())

    return title_01,title_02,td_data_shanghai
#安徽
def row_data_anhui():
    air_anhui = pd.read_html('http://www.weather.com.cn/textFC/hd.shtml#4', encoding='utf-8')
    df = air_anhui[1]
    title_01 = df[0:1].T[0].tolist()
    title_02 = df[1:2].T[1].tolist()
    td_data_anhui = []
    for i in range(10):
        td_data_anhui.append(df[i+2:i+3].T[i+2].tolist())

    return title_01,title_02,td_data_anhui

#广东
def row_data_guangdong():
    air_guangdong = pd.read_html('http://www.weather.com.cn/textFC/hn.shtml', encoding='utf-8')
    df = air_guangdong[1]
    title_01 = df[0:1].T[0].tolist()
    title_02 = df[1:2].T[1].tolist()
    td_data_guangdong = []
    for i in range(10):
        td_data_guangdong.append(df[i+2:i+3].T[i+2].tolist())

    return title_01,title_02,td_data_guangdong